package com.zhkj.txg.module.order.popup

import android.content.Context
import android.graphics.Paint
import android.text.TextUtils
import android.util.Log
import android.view.Gravity
import android.view.View
import android.view.WindowManager
import android.view.animation.Animation
import android.widget.EditText
import android.widget.ImageView
import android.widget.TextView
import com.blankj.utilcode.util.TimeUtils
import com.zhkj.lib.utils.AccountManager
import com.zhkj.lib.utils.ScreenUtil
import com.zhkj.lib.utils.SpanUtil
import com.zhkj.lib.utils.ToastUtil
import com.zhkj.txg.R
import com.zhkj.txg.module.product.entity.ProductEntity2
import com.zhkj.txg.module.product.entity.SpecEntity
import com.zhkj.txg.module.product.entity.SpecPriceEntity
import com.zhkj.txg.module.product.ui.WatcherActivity
import com.zhkj.txg.utils.ImageUtils
import com.zhkj.txg.utils.TextWatcherWrapper
import razerdp.basepopup.BasePopupWindow

class ProductSpecPopupWindow(
    context: Context
) : BasePopupWindow(context) {

//    private var groupType: Int = 0

    init {
        setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)
        setAutoShowInputMethod(false)
    }

    override fun onCreateContentView(): View = createPopupById(R.layout.popup_order_payment)
    override fun onViewCreated(contentView: View?) {

        contentView?.findViewById<View>(R.id.ivClose)?.setOnClickListener { dismiss() }
        // 设置ScrollView的高度
        contentView?.findViewById<View>(R.id.maxScroll)?.layoutParams?.height =
            (ScreenUtil.getScreenHeight(context) * 0.3).toInt()
        contentView?.findViewById<View>(R.id.btnBuyNow)?.setOnClickListener {
            dismiss()
        }
    }

    override fun onCreateShowAnimation(width: Int, height: Int): Animation {
        return getTranslateVerticalAnimation(1F, 0F, 400)
    }

    override fun onCreateDismissAnimation(): Animation {
        return getTranslateVerticalAnimation(0F, 1F, 400)
    }


    /**
     * 设置需要显示的数据
     */
    fun initData(
        productEntity: ProductEntity2
    ) {
        fillData(productEntity)
    }

    /**
     * 数据填充
     */
    private fun fillData(productEntity: ProductEntity2) {

    }

}